<?php
/**
 * @version     1.0.1
 * @package     com_ganeshavereadores
 * @copyright  	
 * @license     
 * @author      Jorge Eduardo
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');

$filter_vereador  = $_GET["filter-vereador"];
$filter_categoria = $_GET["filter-categoria"];


$db =& JFactory::getDBO();

							$sql = 'SELECT distinct ano FROM  #__ganeshavereadores_proposicoes where '; 
							if($filter_categoria)
								$sql .= ' categoria='.$filter_categoria .' AND ';
							else
								$sql .= ' categoria=0 AND ';	

							if($filter_vereador)
								$sql .= ' vereador='.$filter_vereador;
							else
								$sql .= ' vereador=0';	
								
								$sql .= ' ORDER BY ano';
								
$db->setQuery($sql);
$anolist[] = JHTML::_('select.option',  '0', JText::_( ' Selecione o Ano ' ), 'ano', 'ano' );
$anolist = array_merge( $anolist, $db->loadObjectList() );
					?>	
					
	<?php foreach ($anolist as $ano) :?>
							<option value="<?php echo $ano->ano ?>" ><?php echo $ano->ano ?></option>						
						<?php endforeach;?>	